<!-- Copyright (c) 2019-2020 十三 all rights reserved. -->
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <link rel="stylesheet" th:href="@{css/common.css}">
    <link rel="stylesheet" th:href="@{styles/login.css}">
    <link rel="stylesheet" th:href="@{styles/header.css}">
</head>
<body>
<div class="top center">
    <div class="logo center">
        <a href="/index" target="_blank"><img src="image/login-logo-2.png" style="margin-left: -80px"></a>
    </div>
</div>
<div class="form center">
    <div class="login">
        <div class="login_center">
            <div class="login_top">
                <div class="left fl">会员登录</div>
                <div class="right fr">您还不是我们的会员？<a href="/register" target="_self">立即注册</a></div>
                <div class="clear"></div>
                <div class="under-line center"></div>
            </div>
            <form id="loginForm" onsubmit="return false;" action="##">
                <div class="login_main center">
                    <div class="login-info">手机号:&nbsp;<input class="login-info-input" type="text" name="name" id="loginName" placeholder="请输入你的用户名"/>
                    </div>
                    <div class="login-info">密&nbsp;&nbsp;&nbsp;&nbsp;码:&nbsp;
                        <input class="login-info-input" id="password" type="password" name="password" placeholder="请输入你的密码"/></div>
                </div>
                <div class="login_submit">
                    <input class="submit" type="button" id="subbtn" value="立即登录">
                </div>
            </form>
        </div>
    </div>
</div>
</body>
<!-- jQuery -->
<script src="https://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#subbtn").click(function () {
            var formData = $("#loginForm").serialize();
            $.ajax({
                url:"/login",
                dataType:"json",
                method:"post",
                data:formData,
                success : function (data) {
                    if(data=="300"){
                        alert("登陆成功");
                        location.href="/index";
                    }else{
                        alert("密码或用户名错误");
                    }
                }
            })
        })
    })
</script>
</html>